﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ProgramMain.Skins
{
    static class ApplicationSkins
    {
        static public void EnableSkins()
        {
            DevExpress.UserSkins.BonusSkins.Register();
            DevExpress.UserSkins.OfficeSkins.Register();

            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.Skins.SkinManager.EnableFormSkinsIfNotVista();
            DevExpress.Skins.SkinManager.EnableMdiFormSkins();

            Application.EnableVisualStyles();
        }

        static public void ResotreSkinSettings()
        {
            string skinName = Properties.Settings.Default.SkinSettings;

            if (!(skinName is string) || skinName.Length == 0)
            {
                skinName = "Xmas 2008 Blue";
            }
            
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(skinName);
        }

        static public void StoreSkinSettings(string skinName)
        {
            Properties.Settings.Default.SkinSettings = skinName;
            Properties.Settings.Default.Save();
        }

        static public string GetSkinSettings()
        {
            string skinName = Properties.Settings.Default.SkinSettings;

            if (skinName == null || skinName.Length == 0 
                || skinName == DevExpress.LookAndFeel.UserLookAndFeel.DefaultSkinName)
                skinName = "Стандартный";

            return skinName;
        }

        static public void SetSkinSettings(string skinName)
        {
            if (skinName == "Стандартный")
                skinName = DevExpress.LookAndFeel.UserLookAndFeel.DefaultSkinName;

            ProgramMain.Skins.ApplicationSkins.StoreSkinSettings(skinName);
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(skinName);
        }
    }
}
